<template>
	<!--  -->
	<view class="wrap-mag">
		<view class="" :style="{ height: statusBarHeight + 'px' }">

		</view>

		<view class="wrap">

			<view class="head">
				<text class="head-left">嘉会通</text>
				<text class="head-right">具体以申请产品为准</text>

			</view>
			<view class="notice">
				<uni-notice-bar show-icon scrollable backgroundColor="#EEF5FF" color="#333" :fontSize="12"
					text="下载国家反诈中心APP，谨防诈骗电话。" />

			</view>

		</view>
		<view class="advantg">
			<image src="@/static/index/icon_advantg.png" mode=""></image>
			<!-- @click="goPage('/pagesC/trueName/index')" -->
			<!-- <view class="authItem" >相机权限</view> -->
			<view class="btn" @click="openAuth('CAMERA')">

			</view>
		</view>
		<template v-if="false">
			<view class="wrap">
				<view class="tit">
					关于嘉会通
				</view>
				<view class="dis adimgwrap">
					<view class="adimg" v-for="(item,index) in lisad" :key="index">

						<image :src="item.url" mode="scaleToFill"></image>
					</view>
				</view>
			</view>
		</template>
		<template v-else>
			<view class="wrap">
				<view class="tit">
					推荐产品
				</view>
				<!-- <uv-sticky offset-top="-50">
					
				</uv-sticky>
				 -->
				<view class="" style="margin-top: 20rpx;">
					<recommendProducts :list="list" @goInfo="goInfo" v-if="list.length!=0" />
					<noData v-else></noData>
					<!-- <view class="adimg" v-for="(item,index) in lisad" :key="index">
			
						<image :src="item.url" mode="scaleToFill"></image>
					</view> -->
				</view>
			</view>
		</template>

		<view class="des">
			<view class="des-top">
				嘉会通
			</view>
			<view class="des-bot">
				信用无界 借贷自由
			</view>
		</view>
		<authpups ref="authpup" type="top" @changeAuth="changeAuth" :isNativeHead='false' :permissionID="permissionID">
		</authpups>
	</view>


</template>

<script setup>
	import {
		getShopListv1,
		clickShop,
		clickGood,
		clickChannel,
	} from '@/api/index.js'
	import {
		onShow
	} from '@dcloudio/uni-app'
	import recommendProducts from '@/components/list/com/components/list.vue'
	import {
		ref,
		onMounted,
		getCurrentInstance
	} from 'vue'
	const {
		proxy
	} = getCurrentInstance();
	onShow(() => {
		init()
	})
	let statusBarHeight = proxy.$statusBarHeight();
	let lisad = ref([{
		url: '../../static/index/icon_ad_left.png'
	}, {
		url: '../../static/index/icon_ad_right.png'
	}])
	let pageData = ref({
		"pageSize": 20,
		"currentPage": 1
	})
	let list = ref([])
	// 权限弹框开始
	const permissionID = ref('');
	const authpup = ref(null);
	const openAuth = (permission) => {
		console.log("我爱你");
		console.log(permission, 'permission')
		// 平台编译，如果是浏览器H5端，那直接跳转实名认证页面
		//#ifdef H5
		goPage('/pagesC/trueName/index')
		//#endif
		permissionID.value =
			permission // 这个是对应的权限 ACCESS_FINE_LOCATION 位置权限 / WRITE_EXTERNAL_STORAGE 存储空间/照片权限 / CAMERA相机权限 / CALL_PHONE 拨打电话
		setTimeout(() => {
			authpup.value?.open()
		}, 500)
	}
	// 有权限之后的回调
	const changeAuth = () => {
		// 这里是权限通过后执行自己的代码逻辑
		console.log('权限已授权，此时可以调用uni的chooseImage等api了')
		goPage('/pagesC/trueName/index')
	}
	// 权限弹框结束
	let init = async () => {
		let res = await getShopListv1(pageData.value)
		list.value = res.data

		console.log(res, 'res')

	};
	let goPage = (url) => {
		uni.navigateTo({
			url
		})
		console.log("可以跳转相应的页面了")
	};
	let goInfo = async (item) => {
		uni.navigateTo({
			url: '/pagesB/webview/webview?url='+item.h5url
			
		})
		return;
		proxy.$ymmdBtn("ymBtnPro", {
			name: '点击产品带id',
			id: item.id
		})
		let clickShopData = {
			shopId: item.id,
			type: item.openType
		}

		let ress = await clickShop(clickShopData)
		if (item.openType == 0) {
			goPage(item.h5url)
			// 连登
		} else if (item.openType == 1) {
			let data = {
				shopId: item.id,
				type: item.openType
			}
			let ll = await clickGood(data)
			if (ll.code == 100000) {
				let datass = {
					shopId: item.id
				}
				let p = await clickChannel(data)

			}
			// console.log(ll,'llllll')
			goPage(ll.data.h5url)
		}
		// console.log(item, '这是下面的列表数据')
	};
	
	onMounted(() => {
		// console.log(proxy.$statusBarHeight())
	})
</script>
<style>
	page {
		background-image: url(https://oss.jht.jht.cash/img/20250609/2v7feG5Z.png);
		background-size: 100% 100%;

	}
</style>
<style lang="scss" scoped>
	.des {
		margin-top: 40rpx;
		text-align: center;
		color: #BFC3CF;
		font-family: FZLanTingYuan-L-GBK, FZLanTingYuan-L-GBK;
		font-weight: 400;

		.des-bot {
			font-size: 20rpx;
		}

		.des-top {
			font-size: 32rpx;
		}
	}

	.adimgwrap {
		margin-top: 24rpx;
		flex-wrap: wrap;
		justify-content: space-between;

		.adimg {
			width: 48.5%;
			// background: red;
			height: 180rpx;

			image {
				width: 100%;
				height: 100%;
			}

		}
	}

	.tit {
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 32rpx;
		color: #333;
		margin-top: 20rpx;
	}

	.advantg {
		position: relative;

		.btn {
			position: absolute;
			width: 71%;
			height: 2.5rem;

			bottom: 10%;
			left: 14%;
		}

		width: 100%;
		height: 600rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.notice {
		margin: 40rpx 0 20rpx 0;
	}

	.head {
		display: flex;
		align-items: center;

		.head-right {
			color: #999;
			font-size: 24rpx;
			font-weight: 400;
			margin-left: 16rpx;
		}

		.head-left {
			color: #333;
			font-size: 32rpx;
			font-weight: 600;
		}
	}

	.wrap {
		padding: 0 30rpx;
	}

	.wrap-mag {
		// background: linear-gradient( 180deg, #D7EDFD 0%, #F9F9F9 100%);
		// height: 94vh;

	}
</style>